﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL_Class;
using System.IO;


namespace NLLSite.Administrator.UserControl
{
    public partial class AddNewAdvertise : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
          

        protected void btnThem_Click(object sender, EventArgs e)
        {
            bool isfrontPage;
            String vitri ="";
            QuangCao q = new QuangCao();            
            if (ddlVitri.SelectedIndex == 0)
            {
                lblSuccess.Text = "Mời bạn chọn vị trí hiển thị của quảng cáo!";
                lblSuccess.Visible = true;
            }
            else
            {
                String ten = txtTen.Text;
                vitri = ddlVitri.SelectedValue;
                Response.Write(vitri);
                if (CheckBox1.Checked)
                {
                    isfrontPage = true;
                }
                else
                {
                    isfrontPage = false;
                }
                String noidung = CKEditor1.Text;                
                lblSuccess.Text = q.AddNewAdvertise(ten, noidung, vitri, isfrontPage);
                lblSuccess.Visible = true;
                txtTen.Text = "";
                ddlVitri.SelectedIndex = 0;
                CheckBox1.Checked = false;    
                Response.Redirect("QuanliQuangCao.aspx");
                
            }            
        }

        protected void btnHuy_Click(object sender, EventArgs e)
        {
            txtTen.Text = "";
            ddlVitri.SelectedIndex = 0;
            CheckBox1.Checked = false;            
        }
    }
}